{include file="index/header" /}
<body>
	<div class="panel admin-panel">
		<form method="get" action="" id="listform">
			<div class="panel-head"><strong class="icon-reorder"> {$user.know_remarks ?: $user.know_nickname}-{$user.know_phone ?: $user.know_email}</strong> </div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li style="font-size: 17px;">搜索：</li>
					<li>
						<select name="grade" class="input" style="width:400px; line-height:17px;border: solid 1px #09f;font-weight: 700;" onchange="changesearch()"  id="nav">
							<option value="3">请选择状态</option>
							<option value="1" {if $param.grade eq 1}selected{/if}>未点评</option>
							<option value="2" {if $param.grade eq 2}selected{/if}>已点评</option>
						</select>
					</li>
				</ul>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th>ID</th>
					<th>实操标题</th>
					<th>点评老师</th>
					<th>时间</th>
					<th>是否点评</th>
					{if $admin['role_id'] neq 8}<th>是否推荐</th>
					<th>是否免费</th>{/if}
					<th>分数</th>
					<th>操作</th>
				</tr>
				{foreach name='data' item='v'}
				<tr>
					<td>{$v.id}</td>
					<td>{$v.t_name}</td>
					<td>{$v.admin_name}</td>
					<td><?php echo date("Y-m-d H:i:s",$v['time'])?></td>
					<td>{if $v.grade eq 0}否{else}是{/if}</td>
					{if $admin['role_id'] neq 8}<td onclick="changetuijian(this,{$v.id})" style="cursor: pointer;" title="点击修改状态"><font color="#00CC99">{if $v.is_tuijian eq 1}是{else}否{/if}</font></td>
					<td onclick="changefree(this,{$v.id})" style="cursor: pointer;" title="点击修改状态"><font color="#00CC99">{if $v.is_free eq 1}是{else}否{/if}</font></td>{/if}
					<td ><font color="#00CC99">{$v.score}</font></td>
					<td><div class="button-group"><a class="button border-main" onclick="javascript:openwinx('{:url('dianping',['id' => $v['id'],'class_id' => $class_id])}')"><span class="icon-edit"></span> {if $v.grade eq 0}未点评{else}已点评{/if}</a></div></td>
				</tr>
				{/foreach}
				<tr>
					<td colspan="8">{$data->render()}</td>
				</tr>
			</table>
		</form>
	</div>
</body></html>
<script>
//搜索
function changesearch(){  
	$("#listform").submit();
}
function changetuijian(ts,id){
	$.ajax({
		data:{'id':id},
		url:"{:url('tuijian')}",
		type:'post',
		success:function(data){
			if(data == 2){
				alert('修改失败');
			}else{
				if(data == 1){
					var tuijian = '<font color="#00CC99">是</font>';
				}else{
					var tuijian = '<font color="#00CC99">否</font>';
				}
				$(ts).html(tuijian);
			}
		}
	});
}
function openwinx(url,name,w,h) {
	if(!w) w=screen.width-4;
	if(!h) h=screen.height-95;
	window.open(url,name,"top=30,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
}
function changefree(ts,id){
	$.ajax({
		data:{'id':id},
		url:"{:url('free')}",
		type:'post',
		success:function(data){
			if(data == 2){
				alert('修改失败');
			}else{
				if(data == 1){
					var tuijian = '<font color="#00CC99">是</font>';
				}else{
					var tuijian = '<font color="#00CC99">否</font>';
				}
				$(ts).html(tuijian);
			}
		}
	});
}
setcookie('refersh_time', 0);
function refersh_window() {
	var refersh_time = getcookie('refersh_time');
	if(refersh_time==1) {
		window.location.reload();
	}
}
setInterval("refersh_window()", 2000);
</script>